<head>
<link rel="stylesheet" href="/eSDK_OpenAPI_Demo_BS_JAVA/css/tree.css"
	type="text/css">
<link rel="stylesheet"
	href="/eSDK_OpenAPI_Demo_BS_JAVA/css/zTreeStyle.css" type="text/css">
<link rel="stylesheet" href="/eSDK_OpenAPI_Demo_BS_JAVA/css/demo.css"
	type="text/css" />
<link href="/eSDK_OpenAPI_Demo_BS_JAVA/css/thickbox.css" media="screen"
	rel="stylesheet" type="text/css" />
<script type="text/javascript"
	src="/eSDK_OpenAPI_Demo_BS_JAVA/js/jquery-1.8.3.js"></script>
<script type="text/javascript"
	src="/eSDK_OpenAPI_Demo_BS_JAVA/js/jquery.ztree.core-3.5.js"></script>
<script src="/eSDK_OpenAPI_Demo_BS_JAVA/js/en-us.js"
	type="text/javascript"></script>
<script src="/eSDK_OpenAPI_Demo_BS_JAVA/js/zh-cn.js"
	type="text/javascript"></script>
<script src="/eSDK_OpenAPI_Demo_BS_JAVA/js/demotools.js"
	type="text/javascript"></script>

<script type="text/javascript">
	function createLUN() {
		var id = $("#lunId").val();
		var name = $("#lunname").val();
		var description = $("#lunDescription").val();
		var parentId = $("#parentId_lun").val();
		var capacity = $("#lunCapacity").val();
		// 简单参数校验
		if (isEmpty(name)) {
			$("#lunnameErrTip").html(controller.language.titles["nameErrTip"]);
			return false;
		} else {
			$("#lunnameErrTip").html("");
		}
		if (isEmpty(parentId)) {
			$("#storagepoolIdErrTip").html(
					controller.language.titles["storagepoolIdErrTip"]);
			return false;
		} else {
			$("#storagepoolIdErrTip").html("");
		}
		if (isEmpty(capacity)) {
			$("#lunCapacityErrTip").html(
					controller.language.titles["capacityErrTip"]);
			return false;
		} else {
			$("#lunCapacityErrTip").html("");
		}
		if (isEmpty(capacity)) {
			$("#lunCapacityErrTip").html(
					controller.language.titles["capacityIsNumber"]);
			return false;
		} else {
			$("#lunCapacityErrTip").html("");
		}
		$.ajax({
			url : "/eSDK_OpenAPI_Demo_BS_JAVA/openapiServlet",
			type : "post",
			dataType : "json",
			data : "&id=" + id + "&name=" + name + "&description="
					+ description + "&parentId=" + parentId + "&capacity="
					+ capacity + "&method=createLUN",
			async : false,
			success : function(data) {
				if ("success" == data) {
					self.parent.tb_remove();
				} else {
					$("#LUN_status").html(data);
				}
			},
			error : function(data) {
				$("#LUN_status").html(
						controller.language.titles["operationFailed"]);
			},
			beforeSend : function() {
				$("#LUN_status").html("");
			}
		});
	}
	function load() {
		changeLang();
		$.ajax({
			url : "/eSDK_OpenAPI_Demo_BS_JAVA/openapiServlet",
			type : "post",
			dataType : "json",
			data : "&method=getBatchStoragePool",
			async : false,
			success : function(data) {
				$.each(data,
						function(key, value) {
							var Option = document.createElement("OPTION");
							Option.value = key;
							Option.text = value;
							document.getElementById("parentId_lun").options
									.add(Option);
						});
			}
		});
	}
</script>


</head>
<body onload="load()">
	<div class="inoutput_param_div1">
		<table width="100%">
			<tr>
				<td width="10%"></td>
				<td></td>
				<td width="40%"></td>
				<td></td>
			</tr>
			<tr>
				<td></td>
				<td align="left" width="25%"><font color='red'>*</font> <label
					id="nameLabel"></label></td>
				<td align="left"><input type="text" id="lunname" name="lunname"></td>
				<td align="left"><span class="span_tip" id="lunnameErrTip">
				</span></td>
			</tr>
			<tr>
				<td></td>
				<td align="left"><font color='white'>*</font> <label
					id="idLabel"></label></td>
				<td align="left"><input type="text" id="lunId" name="lunId"></td>
			</tr>
			<tr>
				<td></td>
				<td align="left"><font color='white'>*</font> <label
					id="descriptionLabel"></label></td>
				<td align="left"><input type="text" id="lunDescription"
					name="lunDescription"></td>
			</tr>
			<tr>
				<td></td>
				<td align="left"><font color='red'>*</font> <label
					id="storagepoolIdLabel"></label></td>
				<td align="left"><select id="parentId_lun" name="parentId_lun"
					onmouseover="FixWidth(this)" /></td>
				<td align="left"><span class="span_tip"
					id="storagepoolIdErrTip"> </span></td>
			</tr>
			<tr>
				<td></td>
				<td align="left"><font color='red'>*</font> <label
					id="lunCapacityLabel"></label></td>
				<td align="left"><input type="text" id="lunCapacity"
					name="lunCapacity">G</td>
				<td align="left"><span class="span_tip" id="lunCapacityErrTip">
				</span></td>
			</tr>
			<tr>
				<td colspan="2"></td>
				<td align="left"><input class="btn"
					onmouseover="this.className='btn_mouseover'"
					onmouseout="this.className='btn'" type="button" id="createLUNBtn"
					onclick="createLUN();"></td>
				<td></td>
			</tr>
			<tr>
				<td colspan="2"></td>
				<td align="left"><label algin="left" id="LUN_status"
					name="LUN_status"> </label></td>
				<td></td>
			</tr>
		</table>
	</div>
</body>
